package com.zhanglijie.theory.sigleThreadedExecutor;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/7/22 0022 0:21
 */
public class TestSingleThread {
    public static void main(String[] args) {
        SafeGate safeGate = new SafeGate();

        //张
        new Thread(()->{
            System.out.println("zhangsan come in ");
            while(true){
                safeGate.pass("zhangsan","zhangjia");
            }

        },"thread-1").start();

        //李
        new Thread(()->{
            System.out.println("lisi come in ");
            while(true){
                safeGate.pass("lisi","lijia");
            }
        },"thread-1").start();

        //王
        new Thread(()->{
            System.out.println("wanger come in ");
            while(true){
                safeGate.pass("wanger","wangjia");
            }
        },"thread-1").start();
    }
}
